package com.ftg.learn.day10.factory;

/**
 * 冰棍工厂
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/8/10 上午10:56
 */
public class IceFactory {

    /**
     * 生产实例  冰棍
     */
    public static Ice getIceInstance(){
        Ice i1 = new Ice();
        i1.setType("蒙牛");
        i1.setName("四个圈");
        i1.setPrice(5.5);
        return i1;
    }

    public static Ice getIceInstance(String name){
        Ice i1 = new Ice();
        i1.setType("蒙牛");
        i1.setName(name);
        i1.setPrice(5.5);
        return i1;
    }

    public static Ice getIceInstance(String name,double price){
        Ice i1 = new Ice();
        i1.setType("蒙牛");
        i1.setName(name);
        i1.setPrice(price);
        return i1;
    }

    public static Ice getIceInstance(String type,String name,double price){
        Ice i1 = new Ice();
        i1.setType(type);
        i1.setName(name);
        i1.setPrice(price);
        return i1;
    }

    /**
     * t = 1 ice t=2 icehigh
     * @param t
     * @return
     */
    public static Ice getIceInstance(int t){
        switch (t){
            case 2:
                IceHigh i2 = new IceHigh();
                i2.setName("冰高");
                return i2;
            default:
                return getIceInstance();
        }
    }

}
